/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityprojet;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author T.Ron
 */
@Entity
@Table(name = "COMPTEG")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Compteg.findAll", query = "SELECT c FROM Compteg c"),
    @NamedQuery(name = "Compteg.findByIdCg", query = "SELECT c FROM Compteg c WHERE c.idCg = :idCg"),
    @NamedQuery(name = "Compteg.findByNumcg", query = "SELECT c FROM Compteg c WHERE c.numcg = :numcg"),
    @NamedQuery(name = "Compteg.findByLibellecg", query = "SELECT c FROM Compteg c WHERE c.libellecg = :libellecg"),
    @NamedQuery(name = "Compteg.findByTypecg", query = "SELECT c FROM Compteg c WHERE c.typecg = :typecg"),
    @NamedQuery(name = "Compteg.findByTypereport", query = "SELECT c FROM Compteg c WHERE c.typereport = :typereport"),
    @NamedQuery(name = "Compteg.findBySaisieanal", query = "SELECT c FROM Compteg c WHERE c.saisieanal = :saisieanal"),
    @NamedQuery(name = "Compteg.findByCodetaxe", query = "SELECT c FROM Compteg c WHERE c.codetaxe = :codetaxe"),
    @NamedQuery(name = "Compteg.findByNumcr", query = "SELECT c FROM Compteg c WHERE c.numcr = :numcr")})
public class Compteg implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CG")
    private Integer idCg;
    @Basic(optional = false)
    @Column(name = "NUMCG")
    private long numcg;
    @Basic(optional = false)
    @Column(name = "LIBELLECG")
    private String libellecg;
    @Basic(optional = false)
    @Column(name = "TYPECG")
    private short typecg;
    @Column(name = "TYPEREPORT")
    private Short typereport;
    @Column(name = "SAISIEANAL")
    private Short saisieanal;
    @Column(name = "CODETAXE")
    private String codetaxe;
    @Column(name = "NUMCR")
    private String numcr;
    @ManyToMany(mappedBy = "comptegCollection")
    private Collection<Comptea> compteaCollection;
    @JoinTable(name = "COMPTETG", joinColumns = {
        @JoinColumn(name = "ID_CG", referencedColumnName = "ID_CG")}, inverseJoinColumns = {
        @JoinColumn(name = "ID_CT", referencedColumnName = "ID_CT")})
    @ManyToMany
    private Collection<Comptet> comptetCollection;
    @JoinTable(name = "TAXECG", joinColumns = {
        @JoinColumn(name = "ID_CG", referencedColumnName = "ID_CG")}, inverseJoinColumns = {
        @JoinColumn(name = "ID_TAXE", referencedColumnName = "ID_TAXE")})
    @ManyToMany
    private Collection<Taxe> taxeCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCg")
    private Collection<Ecriturec> ecriturecCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "compteg")
    private Collection<Budgetcgpb> budgetcgpbCollection;
    @JoinColumn(name = "ID_TAXE", referencedColumnName = "ID_TAXE")
    @ManyToOne
    private Taxe idTaxe;
    @JoinColumn(name = "NUMNATURECG", referencedColumnName = "NUMNATURECG")
    @ManyToOne(optional = false)
    private Naturecg numnaturecg;
    @JoinColumn(name = "ID_CR", referencedColumnName = "ID_CR")
    @ManyToOne
    private Compter idCr;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCg")
    private Collection<Taxe> taxeCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numcgP")
    private Collection<Comptet> comptetCollection1;

    public Compteg() {
    }

    public Compteg(Integer idCg,long numcg, String libellecg, short typecg, short typereport, short saisieanal, String codetaxe, String numcr, Naturecg numnaturecg) {
        this.idCg = idCg;
        this.numcg = numcg;
        this.libellecg = libellecg;
        this.typecg = typecg;
        this.typereport = typereport;
        this.saisieanal = saisieanal;
        this.codetaxe = codetaxe;
        this.numcr = numcr;
        this.numnaturecg = numnaturecg;
    }
    
    public Compteg(Integer idCg) {
        this.idCg = idCg;
    }

    public Compteg(Integer idCg, long numcg, String libellecg, short typecg) {
        this.idCg = idCg;
        this.numcg = numcg;
        this.libellecg = libellecg;
        this.typecg = typecg;
    }

    public Integer getIdCg() {
        return idCg;
    }

    public void setIdCg(Integer idCg) {
        this.idCg = idCg;
    }

    public long getNumcg() {
        return numcg;
    }

    public void setNumcg(long numcg) {
        this.numcg = numcg;
    }

    public String getLibellecg() {
        return libellecg;
    }

    public void setLibellecg(String libellecg) {
        this.libellecg = libellecg;
    }

    public short getTypecg() {
        return typecg;
    }

    public void setTypecg(short typecg) {
        this.typecg = typecg;
    }

    public Short getTypereport() {
        return typereport;
    }

    public void setTypereport(Short typereport) {
        this.typereport = typereport;
    }

    public Short getSaisieanal() {
        return saisieanal;
    }

    public void setSaisieanal(Short saisieanal) {
        this.saisieanal = saisieanal;
    }

    public String getCodetaxe() {
        return codetaxe;
    }

    public void setCodetaxe(String codetaxe) {
        this.codetaxe = codetaxe;
    }

    public String getNumcr() {
        return numcr;
    }

    public void setNumcr(String numcr) {
        this.numcr = numcr;
    }

    @XmlTransient
    public Collection<Comptea> getCompteaCollection() {
        return compteaCollection;
    }

    public void setCompteaCollection(Collection<Comptea> compteaCollection) {
        this.compteaCollection = compteaCollection;
    }

    @XmlTransient
    public Collection<Comptet> getComptetCollection() {
        return comptetCollection;
    }

    public void setComptetCollection(Collection<Comptet> comptetCollection) {
        this.comptetCollection = comptetCollection;
    }

    @XmlTransient
    public Collection<Taxe> getTaxeCollection() {
        return taxeCollection;
    }

    public void setTaxeCollection(Collection<Taxe> taxeCollection) {
        this.taxeCollection = taxeCollection;
    }

    @XmlTransient
    public Collection<Ecriturec> getEcriturecCollection() {
        return ecriturecCollection;
    }

    public void setEcriturecCollection(Collection<Ecriturec> ecriturecCollection) {
        this.ecriturecCollection = ecriturecCollection;
    }

    @XmlTransient
    public Collection<Budgetcgpb> getBudgetcgpbCollection() {
        return budgetcgpbCollection;
    }

    public void setBudgetcgpbCollection(Collection<Budgetcgpb> budgetcgpbCollection) {
        this.budgetcgpbCollection = budgetcgpbCollection;
    }

    public Taxe getIdTaxe() {
        return idTaxe;
    }

    public void setIdTaxe(Taxe idTaxe) {
        this.idTaxe = idTaxe;
    }

    public Naturecg getNumnaturecg() {
        return numnaturecg;
    }

    public void setNumnaturecg(Naturecg numnaturecg) {
        this.numnaturecg = numnaturecg;
    }

    public Compter getIdCr() {
        return idCr;
    }

    public void setIdCr(Compter idCr) {
        this.idCr = idCr;
    }

    @XmlTransient
    public Collection<Taxe> getTaxeCollection1() {
        return taxeCollection1;
    }

    public void setTaxeCollection1(Collection<Taxe> taxeCollection1) {
        this.taxeCollection1 = taxeCollection1;
    }

    @XmlTransient
    public Collection<Comptet> getComptetCollection1() {
        return comptetCollection1;
    }

    public void setComptetCollection1(Collection<Comptet> comptetCollection1) {
        this.comptetCollection1 = comptetCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCg != null ? idCg.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Compteg)) {
            return false;
        }
        Compteg other = (Compteg) object;
        if ((this.idCg == null && other.idCg != null) || (this.idCg != null && !this.idCg.equals(other.idCg))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityprojet.Compteg[ idCg=" + idCg + " ]";
    }
    
}
